#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void CharacterRound1(char* character,int time)
{
	int length = strlen(character);
	time = time % length;

	for (int i = 0; i < time; i++)
	{
		char tmp = character[0];
		for (int j = 0; j < length - 1; j++)
		{
			character[j] = character[j + 1];
		}
		character[length - 1] = tmp;
	}
}

void CharacterRound2(char* character, int time)
{
	int length = strlen(character);
	time = time % length;
	char* tmp[10] = { 0 };

	strcpy(tmp, character + time);
	strncat(tmp, character, time);
	strcpy(character, tmp);
}

void Reverse(char* character, int left, int right)
{
	while (left < right)
	{
		char tmp = character[left];
		character[left] = character[right];
		character[right] = tmp;
		left++;
		right--;
	}
}

void CharacterRound3(char* character, int time)
{
	int length = strlen(character);
	time = time % length;
	Reverse(character, 0, time - 1);
	Reverse(character, time, length - 1);
	Reverse(character, 0, length - 1);
}

int CharRoundFind(char* s1, char* s2)
{
	int time = strlen(s1);
	for (int i = 1; i < time; i++)
	{
		char tmp = s1[0];
		for (int j = 0; j < time - 1; j++)
		{
			s1[j] = s1[j + 1];
		}
		s1[time - 1] = tmp;

		if (strcmp(s1, s2) == 0)
		{
			return 1;
		}
	}
	return 0;
}

void main()
{
		char c1[] = "ABCD";
		char c2[] = "CDAB";
		int ret = CharRoundFind(c1, c2);
		if (ret)
			printf("Find it!!!\n");
		else
			printf("Cannot find it\n");
}